﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Example_SeoulOpenAPI.Services;

namespace Example_SeoulOpenAPI
{
    public partial class PassingInfoPage : PhoneApplicationPage
    {
        public PassingInfoPage()
        {
            InitializeComponent();

            StationService.TrainStoryDownloadCompleted += new StationService.TrainStoryDownloadStatus(StationService_TrainStoryDownloadCompleted);
        }

        
        private void DownloadButton_Click(object sender, RoutedEventArgs e)
        {
            StationService.DownloadTrainStoryAsync("2001", "2", "1");
        }

        void StationService_TrainStoryDownloadCompleted(Exception errorStatus, System.Collections.ObjectModel.ObservableCollection<ViewModels.PassingStation> passingStation)
        {
            PassingStationListBox.ItemsSource = passingStation;
        }
    }
}